<!-- 维修审核页面 -->
<template>
	<view class="">
		<dispatch titleName="维修审核" compoType="wxsh" :treeData="copyData"  @searchChange="searchChange" @determine="determine"></dispatch>
	</view>
</template>


<script>
	import dispatch from '../common/dispatch.vue'
	import searchCom from "@/components/searchCom.vue"
	import mixins from '@/utils/mixins.js'
	import {
		lineSectionAuditList, // 维修审核树形列表
	} from '@/api/engineeringMaintenance/maintenanceTask.js'
	export default {
		name:'repair',
		mixins:[mixins],
		components: {
			searchCom,
			dispatch
		},
		data() {
			return {
				TreeData:[],
				keyword:undefined,
				copyData:[]
			}
		},
		onShow() {
			this.lineSectionAuditList()
			console.log(new Date(),'shijian ');
		},
		methods: {
			// 获取维修审核维修树形数据
			lineSectionAuditList() {
				lineSectionAuditList({
					projectId: uni.getStorageSync('isOwner'),
					projectStates: ["zj","zt"],
					code:'gcwb',
					type:'repair_review'
				}).then(res => {
					console.log(res, '树形结构')
					if (res.status === 1 && res.success) {
						this.TreeData = res.result
						this.copyData = this.filterData(res.result)
					}
				})
			},
			/**
			 * 输入框值变化的时候
			 * @param {String} val
			 */
			searchChange(val) {
				// this.keyword = val
				if(!val) {
					this.copyData = this.filterData(this.TreeData)
				}
			},
			determine(ev) {
				if(!ev) {
					this.copyData = this.filterData(this.TreeData)
				}else{
					this.copyData = this.mapTree(ev, this.TreeData)
				}
			},
		}
	}
</script>
<style lang="scss" scoped>

</style>